package day03;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class DemoRequest extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println(request);
		
	String name = request.getParameter("name");
		System.out.println(name);
	}
	
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse resp) throws ServletException, IOException {
//		String name = request.getParameter("name");
//		
//		byte[] bytes = name.getBytes("iso-8859-1");
//		String s = new String(bytes, "utf-8");
//		
//		System.out.println(s);
//		
//		String name2 = new String(name.getBytes("iso-8859-1"), "utf-8");
//		System.out.println(name2);
		
		request.setCharacterEncoding("utf-8");
		
		System.out.println(request.getParameter("name"));
	}
}
